from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/', methods = ['GET'])
def checkStatus():
    with open('status.txt', 'r') as f:
        status = f.readline()
    return status

@app.route('/change', methods = ['GET'])
def changeStatus():
    with open('status.txt', 'r') as f:
        status = f.readline()
        f.close()
    if status == '1':
        status = '0'
    else:
        status = '1'
    with open('status.txt', 'w') as f:
        f.write(status)
    return status
    

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)
